DECLARE @Video_Code int
DECLARE @Event_Code nvarchar(50)
DECLARE @Event_ID uniqueidentifier
DECLARE @URL nvarchar(max)
DECLARE @Caption nvarchar(max)
DECLARE @Duration nvarchar(max)
DECLARE @VideoOrder int
DECLARE @FirstName nvarchar(max)
DECLARE @People_ID uniqueidentifier

SET @Event_Code = ''
SET @URL = ''
SET @Caption = ''
SET @Duration = ''
SET @FirstName = ''

SELECT @Video_Code = MAX(Video_code) + 1 from Video
SELECT @Event_ID = Event_ID FROM Event WHERE @Event_Code = Event_Code
SELECT @VideoOrder = MAX([Order]) + 1 FROM Video


INSERT INTO Video (Video_Code, Event_ID, URL, Caption, Duration, IsVisible, [Order])
VALUES (@Video_Code, 
		@Event_ID, 
		@URL, 
		@Caption,
		@Duration,
		1,
		@VideoOrder)	
	
DECLARE @Video_ID uniqueidentifier
SELECT @Video_ID = Video_ID FROM Video WHERE Video_Code = @Video_Code
SELECT @People_ID = People_ID FROM People WHERE FirstName = @FirstName
	
INSERT INTO PicturePeople (Video_ID, People_ID) 
	VALUES (@Video_ID, @People_ID)
	